package edu.hrbu.trade01.util;

import edu.hrbu.trade01.entity.Firm;
import edu.hrbu.trade01.entity.VipFirm;
import edu.hrbu.trade01.vo.VipFirmUpdateVo;

import java.time.LocalDateTime;
import java.util.HashMap;

import static edu.hrbu.trade01.util.ConstUtil.IS_VIP;

/**
 * @author 徐登宇
 */
public class VipFirmUpdateVoUtil {
    private VipFirmUpdateVoUtil() {
    }

    public static HashMap<String, Object> fitfirmAndVipFirm(VipFirmUpdateVo vipFirmUpdateVo) {
        // 组装firm 和 vipfirm
        String business = vipFirmUpdateVo.getBusiness();
        String contact = vipFirmUpdateVo.getContact();
        LocalDateTime createTime = vipFirmUpdateVo.getCreateTime();
        String detailInfo = vipFirmUpdateVo.getDetailInfo();
        Integer duration = vipFirmUpdateVo.getDuration();
        Long firmId = vipFirmUpdateVo.getFirmId();
        String firmName = vipFirmUpdateVo.getFirmName();
        int isRecomment = vipFirmUpdateVo.getIsRecomment();
        String loginPwd = vipFirmUpdateVo.getLoginPwd();
        String loginName = vipFirmUpdateVo.getLoginName();
        String smInfo = vipFirmUpdateVo.getSmInfo();
        String tel = vipFirmUpdateVo.getTel();
        String type = vipFirmUpdateVo.getType();
        Long vipId = vipFirmUpdateVo.getVipId();
        String picPath = vipFirmUpdateVo.getPicPath();


        Firm firm = new Firm(firmId, firmName, business, contact, tel, loginName, loginPwd, IS_VIP, 0);
        VipFirm vipFirm = new VipFirm(vipId, firmId, createTime, duration, isRecomment, type, picPath, smInfo, detailInfo);

        HashMap<String, Object> map = new HashMap<>();
        map.put("firm", firm);
        map.put("vipFirm", vipFirm);
        return map;
    }
}
